package com.example.account;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

public class BottomNavigationFragment extends Fragment {

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_bottom_navigation, container, false);

        ImageView imgAnalyse = view.findViewById(R.id.img_analyse);
        ImageView imgAdd = view.findViewById(R.id.img_add);
        ImageView imgMore = view.findViewById(R.id.img_more);

        imgAnalyse.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                main_analyse();
            }
        });

        imgAdd.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                main_add();
            }
        });

        imgMore.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                main_more();
            }
        });

        return view;
    }

    private void main_analyse() {
        // 在这里添加进入分析活动的逻辑
        Intent intent = new Intent(getActivity(), AnalyseActivity.class);
        startActivity(intent);
    }

    private void main_add() {
        // 在这里添加进入添加记录活动的逻辑
        Intent intent = new Intent(getActivity(), RecordActivity.class);
        intent.putExtra("type", "add");
        startActivity(intent);
    }

    private void main_more() {
        // 在这里添加进入更多活动的逻辑
        Intent intent = new Intent(getActivity(), MoreActivity.class);
        startActivity(intent);
    }
}
